package com.example.pertecttime.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

/**
 * Created by 半生瓜 on 2017/3/1.
 */

public class TabFragmentPagerAdapter extends FragmentPagerAdapter {
    ArrayList<Fragment>datas;
    ArrayList<String>titles;

    public TabFragmentPagerAdapter(FragmentManager fm) {
        super(fm);

    }


    public void setData(ArrayList<Fragment>datas){
        this.datas=datas;
    }
public void setTitles(ArrayList<String>titles){
    this.titles=titles;
}



    @Override
    public Fragment getItem(int position) {
        return datas==null?null:datas.get(position);
    }

    @Override
    public int getCount() {
        return datas==null?0:datas.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles==null?null:titles.get(position);
    }


}
